package com.docmgmt.mvp.ragflow.dto;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import jakarta.validation.constraints.DecimalMax;
import jakarta.validation.constraints.DecimalMin;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;

/**
 * LLM 设置 DTO
 * 
 * 用于Chat Assistant的llm_setting字段
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class LLMSettingDTO {

    /**
     * 温度参数（0-1）
     * 控制输出的随机性，越高越随机
     */
    @DecimalMin(value = "0.0", message = "temperature必须>=0")
    @DecimalMax(value = "1.0", message = "temperature必须<=1")
    private Float temperature;

    /**
     * Top-p采样参数（0-1）
     * 控制输出的多样性
     */
    @JsonProperty("top_p")
    @DecimalMin(value = "0.0", message = "top_p必须>=0")
    @DecimalMax(value = "1.0", message = "top_p必须<=1")
    private Float topP;

    /**
     * Presence penalty（-2.0 到 2.0）
     * 控制重复内容的惩罚
     */
    @JsonProperty("presence_penalty")
    @DecimalMin(value = "-2.0", message = "presence_penalty必须>=-2.0")
    @DecimalMax(value = "2.0", message = "presence_penalty必须<=2.0")
    private Float presencePenalty;

    /**
     * Frequency penalty（-2.0 到 2.0）
     * 控制词频的惩罚
     */
    @JsonProperty("frequency_penalty")
    @DecimalMin(value = "-2.0", message = "frequency_penalty必须>=-2.0")
    @DecimalMax(value = "2.0", message = "frequency_penalty必须<=2.0")
    private Float frequencyPenalty;

    /**
     * 最大token数
     */
    @JsonProperty("max_tokens")
    @Min(value = 1, message = "max_tokens必须>=1")
    @Max(value = 32768, message = "max_tokens必须<=32768")
    private Integer maxTokens;
}

